<link href="/js/boxy/css/boxy.css" media="screen" rel="stylesheet" type="text/css" >
<link href="/admins/css/yundan.css" rel="stylesheet" type="text/css" />
<link href="/js/boxy/css/boxy.css" media="screen" rel="stylesheet" type="text/css" >  
<script type="text/javascript" src="/admins/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="/js/boxy/js/jquery.boxy.js"></script>
<link href="/js/boxy/css/boxy.css" media="screen" rel="stylesheet" type="text/css" >  
<script type="text/javascript">
      $(function() {
            window.alert = Boxy.alert;
            window.confirm = Boxy.confirm;
      });

<?php if ($this->conse == 1) { ?>
            Boxy.alert('添加成功！');
            window.setTimeout("location.href = '/admini/todotask/index'", 2000);
<?php } ?>
</script>
<style>
      .button {
            display: inline-block;
            outline: none;
            cursor: pointer;
            text-align: center;
            text-decoration: none;
            font: 14px/100% Arial, Helvetica, sans-serif;
            padding: .5em 2em .55em;
            text-shadow: 0 1px 1px rgba(0,0,0,.3);
            -webkit-border-radius: .5em; 
            -moz-border-radius: .5em;
            border-radius: .5em;
            -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
            -moz-box-shadow: 0 1px 2px rgba(0,0,0,.2);
            box-shadow: 0 1px 2px rgba(0,0,0,.2);
            color: #fef4e9;
            border: solid 1px #da7c0c;
            background: #f78d1d;
            background: -webkit-gradient(linear, left top, left bottom, from(#faa51a), to(#f47a20));
            background: -moz-linear-gradient(top,  #faa51a,  #f47a20);
            filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#faa51a', endColorstr='#f47a20');
      }
      .button:hover {
            text-decoration: none;
            background: #f47c20;
            background: -webkit-gradient(linear, left top, left bottom, from(#f88e11), to(#f06015));
            background: -moz-linear-gradient(top,  #f88e11,  #f06015);
            filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#f88e11', endColorstr='#f06015');
      }
      .button:active {
            position: relative;
            top: 1px;
            color: #fcd3a5;
            background: -webkit-gradient(linear, left top, left bottom, from(#f47a20), to(#faa51a));
            background: -moz-linear-gradient(top,  #f47a20,  #faa51a);
            filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#f47a20', endColorstr='#faa51a');
      }
</style>
<div id="form">
      <form action="" method="post" id="ingform">     
            <div class="rukutop">
                  <div class="rktopleft" style="width:1000px;">
                        <div class="rukushuru">
                              <table>
                                    <tr>
                                          <td  colspan="2" align="center">添加<?php if ($this->objectId) {
                                                echo'代购订单：' . $this->objectId;} ?>待办事项
                                          </td>
                                    </tr>

                              </table>
                        </div>
                        <div class="rukushuru" style="color:#c00;padding:8px 0;width: 400px;margin-left: 10px;" id="userRemark">
                        </div>
                  </div>
                  <div class="rktopright">
                        <div class="rukuxinfo"><p></p></div>
                        <div class="kuwei"></div>
                  </div>
            </div>
            <div class="rukunr">
                  <div style="width:800px;font-size:14px;padding: 20px;">
                        <div>
                              <div class="rk1z">
                                    <table>
                                          <tr>
                                                <td width="50%" >预计日期：</td>
                                                <td>
                                                      <input type="hidden" id="starttime" name="starttime" value="<?php echo $this->starttime ? $this->starttime : ""; ?>"/>
                                                      <div class="time" style="padding:6px 5px;border:#ccc solid 1px;width: 200px">
                                                            <!--点击后悬停样式为：<div class="timeselect t_on">-->
                                                            <div class="timeselect"  id="stime">
                                                                  <span id="stimeval"><?php echo $this->starttime ? $this->starttime : date("Y-m-d", mktime(0, 0, 0, date("m"), date("d"), date("Y"))); ?></span><i></i>
                                                            </div>
                                                            <div class="timeslelctbox">
                                                                  <!---时间插件放此DIV-->
                                                            </div>
                                                      </div>
                                                </td>
                                          </tr>
                                          <tr>
                                                <td class="rkz">事项类型：</td>
                                                <td>
                                                      <input id="object-Type" type="hidden" value="<?= $this->objectType ?>" />
                                                      <input id="obj-id" type="hidden" value="<?= $this->objectId ?>" />
                                                      <select class="input3 w200 required" id="objectType" name="objectType" >
                                                            <option value="1">代购</option>
                                                            <option value="2">退换货</option>
                                                            <option value="3">自定义</option>
                                                      </select>
                                                </td>
                                          </tr>
                                          <tr>
                                                <td class="rkz">关联单号：</td>
                                                <td><input class="input3 w200" id="objectid" name="objectid" required="" style="width:195px;" value="<?= $this->objectId ?>" /></td>
                                          </tr>
                                          <tr>
                                                <td class="rkz">优先级别：</td>
                                                <td>
                                                      <select id="priority" name="priority" class="input3 w200">
                                                            <option value="1">一般</option>
                                                            <option value="2">较低</option>
                                                            <option value="3">较高</option>
                                                            <option value="3">最高</option>
                                                      </select>
                                                </td>
                                          </tr>    
                                          <tr>
                                                <td class="rkz">名称：</td>
                                                <td><input class="input3 w600 required" required="" name="title" id="title"  value =""/></td>
                                          </tr>
                                          <tr id="qdremark">
                                                <td class="rkz">内容：</td>
                                                <td style="padding:1px;"><textarea name="content" id="content" required="" class="textarea w600"></textarea>
                                                </td>
                                          </tr>
                                          <tr >
                                                <td class="rkz">状态：</td>
                                                <td>
                                                      <select id="objstatus" name="objstatus" class="input3 w200">
                                                            <option value="1">未开始</option>
                                                            <option value="2">进行中</option>
                                                            <option value="3">已完成</option>
                                                      </select>
                                                </td>
                                          </tr>
                                          <tr>
                                                <td class="rkz"></td>
                                                <td><input type="submit" class="button" id="objsubmit" value="提交">
                                                      <input type="button" style="margin-left:30px;" class="button" value="返回" onclick="window.history.back()" >
                                                </td>
                                          </tr>
                                    </table>
                              </div>
                        </div>
                  </div>
                  <hr style="margin-left:-20px;">
            </div>
      </form>
</div>
<div id="tracktable">
      <?php
      if ($this->objlist) {
            echo'<div style="font-size:14px;padding: 20px;">该订单的其他待办事项：</div>';
            ?>
            <div class="biaotbody">
                  <table >
                        <tr>
                              <th class="li6" style="text-align:center">
                                    日期
                              </th>
                              <th class="li6" >
                                    类型
                              </th>
                              <th class="li6" >
                                    创建人
                              </th>
                              <th class="li10">
                                    标题
                              </th>
                              <th class="li6" >
                                    状态
                              </th>
                              <th class="li10">
                                    操作
                              </th>
                        </tr>
                  </table>
            </div>
            <?php
            foreach ($this->objlist as $key => $Item) {
                  if ($key > 2)
                        break;
                  ?>
                  <div class="tablebox">
                        <table>
                              <tr>
                                    <td class="li6" align="center"><?= $Item->dateCreated ?></td>
                                    <td class="li6"><?php echo $Item->ObjectName->name; ?></td>
                                    <td class="li6">
                                          <?= $Item->creator//$Item->UserName?$Item->UserName->nikename:'' ?>
                                    </td>
                                    <td class="li10"><?php echo $Item->title; ?></td>
                                    <td class="li6" ><?php echo $Item->ObjectStatus; ?>
                                    </td>
                                    <td class="li10">
                                          <a href="/admini/todotask/detail/id/<?= $Item->id ?>">查看详情</a>
                                    </td>
                              </tr>
                        </table>
                  </div>
                  <?php
            }
      } else {
            echo '<div class="tablebox"></div>';
      }
      ?>
</div>
<script>
      $(document).ready(function() {
            $('form').validate();
            $("#stime").click(function() {
                  $(this).attr("class", "timeselect t_on");
                  WdatePicker({el: 'stimeval', vel: 'starttime', onpicked: function() {
                              $("#stime,#etime").attr("class", "timeselect");
                              $(".soubox #timescope").val("");
                        }});
            });
            var objectType = $('#object-Type').val();
            if (objectType) {
                  $("#objectType option[value =" + objectType + "]").attr("selected", true);
            } else {
                  $("#objectType option[value = 3]").attr("selected", true);
                  $("#objectid").attr("style", "display:none;");
                  $("#objectid").val("0");
            }
            $("#objectType").change(function() {
                  if ($('#objectType').val() == 3) {
                        $("#objectid").attr("style", "display:none;");
                        $("#objectid").val("0");
                  } else {
                        $("#objectid").attr("style", "display:block;");
                        $("#objectid").val("");
                        $("#objectid").focus();
                  }
            });
      });
</script>
